home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor2 / quantum.src < prev    next >
Text File  |  1992-08-18  |  5KB  |  127 lines

  1. %%HP: T(3)A(D)F(.);
  2. @ QUANTUM by Paul Edgar Raines
  3. DIR
  4.  
  5. W3J
  6. @ This program calculates Wigner 3-j symbols.
  7. @       It uses the following formula.
  8. @
  9. @       │ J1 J2 J3 │         J1-J2-M3
  10. @       │ M1 M2 M3 │  M  (-1)         delta(J1,J2,J3) w3jf(J1,J2,J3,M1,M2,M3)
  11. @
  12. @                           │                                       │1/2
  13. @   where                   │ (J1+J2-J3)! (J1-J2+J3)! (-J1+J2+J3)!  │
  14. @         delta(J1,J2,J3) = │ ───────────────────────────────────── │
  15. @                           │            (J1+J2+J3+1)!              │
  16. @                           │                                       │
  17. @                │                                                       │1/2
  18. @   and   w3jf = │ (J1+M1)! (J1-M1)! (J1+M1)! (J1-M1)! (J1+M1)! (J1-M1)! │
  19. @                │                                                       │
  20. @      ─────                               V
  21. @       \                              (-1)
  22. @    *   >  ─────────────────────────────────────────────────────────────────
  23. @       /   V! (J1+J2-J3-V)! (J1-M1-V)! (J2+M2-V)! (J3-J2+M1+V)! (J3-J1-M2+V)!
  24. @      ─────
  25. @        V
  26. @
  27. @   where V is over all values such that there are no negative factorials.
  28. @
  29. @   Enter Wigner 3-j symbols as a 2x3 matrix as shown below.
  30. @                1: [[ 1.5 1 .5 ]
  31. @                    [ .5 -1 .5 ]]
  32. @   which produces
  33. @                1:  .288675134595   or '{(1/12)'
  34. @
  35. \<< OBJ\-> DROP                      @ decompose w3j symbol
  36.   \-> J1 J2 J3 M1 M2 M3              @ read in w3j elements
  37.   \<< -1 J1 J2 M3 + - ^              @ calculate over all sign
  38.       J1 J2 + J3 - !                 @ calculate delta part
  39.       J1 J2 - J3 + ! *
  40.       J2 J1 - J3 + ! *
  41.       J1 J2 + J3 + 1 + ! /
  42.       \v/ *
  43.  
  44.       J1 M1 + !                      @ calculate first part of w3jf
  45.       J1 M1 - ! *
  46.       J2 M2 + ! *
  47.       J2 M2 - ! *
  48.       J3 M3 + ! *
  49.       J3 M3 - ! * \v/ *
  50.  
  51.       J1 J2 + J3 -                   @ calculate elements for the
  52.       J1 M1 - J2 M2 +                @    second part of w3jf
  53.       J3 J2 - M1 +                   @    to determine iteration
  54.       J3 J1 - M2 -                   @    bounds for 'V'
  55.       \-> W1 W2 W3 W4 W5             @ read in elements
  56.       \<< W1 W2 MIN W3 MIN           @ determine lower bound for 'V'
  57.           0 -1 W4 * MAX              @ determine upper bound for 'V'
  58.           -1 W5 * MAX
  59.           \-> XH XL                  @ read in bounds
  60.           \<<
  61.           IF 'XH<XL'                 @ if bounds improper
  62.           THEN 1                     @      return 1
  63.           ELSE 0 XL XH               @ else calculate second part
  64.             FOR V V ! W1 V - ! *     @      of w3jf
  65.               W2 V - ! * W3 V - ! *
  66.               W4 V + ! * W5 V + ! *
  67.               INV -1 V ^ * +
  68.             NEXT
  69.           END
  70.           \>>
  71.       \>>
  72.       *                              @ multiply w3jf 2nd part to rest
  73.    \>>
  74. \>>
  75.  
  76. C&G
  77. @ This program calculates Clebsch-Gordan coefficients.
  78. @       Put the C-G coeff. on level one of the stack in
  79. @       < J1 J2 M1 M2 3 J3 M3> form as a list.
  80. @
  81. @                        1:  { J1 J2 M1 M2 J3 M3 }
  82. @       which gives
  83. @                        1:
  84. @
  85. @       If you prefer < J1 M1 J2 M2 3 J3 M3> form or any other,
  86. @       just switch the order on line 2 of the program to your preference.
  87. @
  88. \<< OBJ\-> DROP NEG                  @ decompose Clebsch-Gordan coefficient
  89.   \-> J1 J2 M1 M2 J3 M3              @ read in C-G elements
  90.   \<< -1 J1 J2 M3 + - ^              @ calculate over all sign
  91.       2 J3 * 1 + \v/ *               @ calculate conversion factor
  92.       J1 J2 J3 M1 M2 M3              @ calculate Wigner 3-j symbol
  93.       { 2 3 } \->ARRY W3J *
  94.   \>>
  95. \>>
  96.  
  97. JGEN
  98. @ J-matrices generator
  99. @        This program generates the J^2, Jz, J-, and J+ matrices
  100. @        for an arbitrary spin/ang.mom/j given on stack.
  101. @        For a spin of 3/2 but 1.5 in level one.
  102. \<< \-> S                       @ read spin/ang.mom./j into 'S'
  103.   \<< S -1 * S FOR R            @ iterate 'R' from '-S' to 'S-1' {row}
  104.       S -1 * S FOR C            @ iterate 'C' from '-S' to 'S-1' {col}
  105.       R C - 1
  106.       IF SAME THEN              @ if on bottom off diagonal calc
  107.       S C - S C + 1 + * \v/     @    proper element for matrix
  108.       ELSE 0 END                @ else put a zero
  109.     NEXT NEXT
  110.     S 2 * 1 +                   @ put together Jminus
  111.     DUP 2 \->LIST \->ARRY
  112.     DUP 'JM' STO                @ duplicate matrix and store as 'JM'
  113.     TRN 'JP' STO                @ transpose Jminus and store as 'JP'
  114.     0 S 2 * FOR R               @ iterate 'R' from '0' to '2*S' {row}
  115.     0 S 2 * FOR C               @ iterate 'C' from '0' to '2*S' {col}
  116.       R C SAME S R - *          @ if on diagonal, calc proper element
  117.     NEXT NEXT
  118.     S 2 * 1 +                   @ put together Jz
  119.     DUP 2 \->LIST \->ARRY
  120.     'Jz' STO                    @ store as 'Jz'
  121.     S 2 * 1 + IDN S S 1 +       @ build Jsquared matrix
  122.     * * 'J2' STO                @ store as 'J2'
  123.   \>>
  124. \>>
  125.  
  126. END
  127.